package com.example.webcomen.Service;

import com.example.webcomen.Mapper.*;
import com.example.webcomen.Model.AddMessage;
import com.example.webcomen.Model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.soap.SOAPBinding;

@Service
public class UpdateService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private GroupMapper groupMapper;
    @Autowired
    private AddMessageMapper addMessageMapper;
    @Autowired
    private FriendGroupDetailMapper friendGroupDetailMapper;
    @Autowired
    private FriendGroupMapper friendGroupMapper;
    @Autowired
    private GroupMemberMapper groupMemberMapper;
    @Autowired
    private MessageMapper messageMapper;

    public Boolean editSignById(int id,String sign){
        User user=new User(id);
        user.setSign(sign);
        if (userMapper.selectById(id)!=null) {
            userMapper.updateById(user);
        }else {
            return false;
        }
        return true;
    }
    public Boolean editStatusById(int id,String status){
        User user=new User(id);
        user.setStatus(status);
        if (userMapper.selectById(id)!=null) {
            userMapper.updateById(user);
        }else {
            return false;
        }
        return true;
    }
//    public Boolean acceptInvi(Integer id){
//        AddMessage addMessage= addMessageMapper.selectById(id);
//        if (addMessage!=null) {
//            addMessage.setType(1);
//            addMessageMapper.updateById(addMessage);
//
//
//        }else {
//            return false;
//        }
//        return true;
//    }
}
